package com.vimi8.chick.plugins.module;

import com.alibaba.weex.plugin.annotation.WeexModule;
import com.taobao.weex.annotation.JSMethod;
import com.taobao.weex.bridge.JSCallback;
import com.taobao.weex.common.WXModule;
import com.vimi8.chick.plugins.event.http.EventHttp;

@WeexModule(name = "vmHttp", lazyLoad = true)
public class HttpModule extends WXModule {

    @JSMethod(uiThread = false)
    public void fetch(String params, final JSCallback jsCallback) {
        EventHttp eventHttp = new EventHttp();
        eventHttp.fetch(params, mWXSDKInstance.getContext(), jsCallback);
    }

    @JSMethod
    public void uploadImage(String params, final JSCallback jsCallback) {
        EventHttp eventHttp = new EventHttp();
        eventHttp.uploadImage(params, mWXSDKInstance.getContext(), jsCallback);
    }

    @JSMethod
    public void uploadObject(String params, final JSCallback jsCallback) {
        EventHttp eventHttp = new EventHttp();
        eventHttp.uploadObject(params, mWXSDKInstance.getContext(), jsCallback);
    }

}
